home *** CD-ROM | disk | FTP | other *** search
- ;;
- ;;
- ;; Switch between translated (LF<-->CRLF) and untranslated reading
- ;; and writing of files in Gnu-emacs.
- ;;
- ;; Make this part of your default.el file and it will load automatically.
- ;; On Atari ST you may want to add also a '(text-files)' line
- ;;
- ;; Michal Jaegermann, 14 January 1992
- ;;
-
-
- (defun delete-msbs()
- (save-excursion
- (goto-char (point-min))
- (perform-replace "\r$" "" nil t nil)
- (set-buffer-modified-p nil)))
-
- (defun add-msbs()
- (save-excursion
- (goto-char (point-min))
- (perform-replace "$" "\r" nil t nil)
- ;; for fancier handling which will not double existing ^M's use
- ;; this instead of the line above
- ;; (perform-replace "[^\r]$" "\\&\r" nil t nil)
- (write-region (point-min) (point-max) buffer-file-name nil t)
- (delete-msbs)))
-
- (defun text-files()
- "Switch emacs for files in MessyDos style line ends"
- (interactive)
- (setq find-file-hooks
- (cons 'delete-msbs (delq 'delete-msbs find-file-hooks)))
- (setq write-file-hooks
- (cons 'add-msbs (delq 'add-msbs write-file-hooks))))
-
- (defun binary-files()
- "Do not translate any line terminators"
- (interactive)
- (setq find-file-hooks (delq 'delete-msbs find-file-hooks))
- (setq write-file-hooks (delq 'add-msbs write-file-hooks)))
- ;;;
-